package com.jinzhu.dao;

import com.jinzhu.pojo.*;
import org.apache.ibatis.annotations.*;

import java.time.LocalDateTime;
import java.util.List;
import java.util.Map;

@Mapper
public interface StuMapper {
    // 根据内容分页查询学员
    List<Student> AllStu1(String name, Integer degree, Integer clazzId, Integer begin, Integer end);
    // 根据批量ID删除学员
    Integer delete(Integer[] ids);
    // 添加学员
    @Insert({"insert into student(name,no,gender,phone,id_card,is_college,address,degree,graduation_date,clazz_id,violation_count,violation_score,create_time,update_time)" +
    "values (#{name},#{no},#{gender},#{phone},#{idCard},#{isCollege},#{address},#{degree},#{graduationDate},#{clazzId},#{violationCount},#{violationScore},#{createTime},#{updateTime})"})
    Integer add(Student student);

    // 根据ID查询学员
    @Select("select * from student where id = #{id}")
    Student get(Integer id);
    // 修改学员
    Integer update(Student student);

    // 班级人数统计
//    @Select("select clazz_id,count(id) from student group by clazz_id order by count(id) asc ")
    List<Map<String, Object>>studentCountData();
    // 学员学历统计
//    @Select("select degree,count(id) from student group by degree order by degree")
    List<Map<String, Object>> studentDegreeData();

    Integer violation(@Param("id") Integer id,
                      @Param("violationScore") Short violationScore,
                      @Param("updateTime")LocalDateTime updateTime);


}


